package cn.school.mybatis.test;

import cn.school.mybatis.Util.SpringMButil;
import cn.school.mybatis.pojo.Grade;
import cn.school.mybatis.pojo.Student;
import cn.school.mybatis.service.GradeService;
import cn.school.mybatis.service.StudentService;
import org.junit.jupiter.api.Test;

import java.util.List;


public class SMtest2 {

    @Test
    public void test(){
        StudentService studentService= SpringMButil.getBean(StudentService.class);
        Student student=studentService.get(1);
        System.out.println(student);
    }

    @Test
    public void test2(){
        StudentService studentService= SpringMButil.getBean(StudentService.class);
        Student student2= new Student("李狗蛋8282", "男", "128282", "2338282", "ligoudan8282", 3, "2020-07-04", "巢湖", "2020-07-05", "合肥包河","123456","pic");
        System.out.println(student2);
        System.out.println(studentService.add(student2));
    }
    @Test
    public void test3(){
        GradeService gradeService= SpringMButil.getBean(GradeService.class);
        List<Grade> lists=gradeService.searchAll();
        for (Grade g:lists){
            System.out.print(g);
        }
    }


    public static void main(String[] args) {
        StudentService studentService= SpringMButil.getBean(StudentService.class);
        Student student=studentService.get(1);
        System.out.println(student);

       Student student2= new Student("李狗蛋828", "男", "12828", "233828", "ligoudan828", 3, "2020-07-04", "巢湖", "2020-07-05", "合肥包河","123456","pic");
        System.out.println(student2);
        System.out.println(studentService.add(student2));
    }
}
